update configure to guess name of Qt Core library and check for the use of reduce...
authortsteven4 <tsteven4@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 25 May 2014 23:38:24 +0000 (23:38 +0000)
committertsteven4 <tsteven4@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 25 May 2014 23:38:24 +0000 (23:38 +0000)
gpsbabel/Makefile.in
gpsbabel/configure
gpsbabel/configure.in

index fab6dd8d08cdb102804f71f4551f7069529e7c5f..8fdd57fe104b151d3b8481432a5f2edc0b2386a4 100644 (file)
@@ -52,7 +52,7 @@ LRELEASE=@LRELEASE@
 #DEBUGGING=-g $(EXTRA_DEBUGGING)
 # add -DDEBUG_MEM to turn on memory allocation logging
 GBCFLAGS=$(EXTRA_CFLAGS) $(DEBUGGING) -I$(srcdir) @QT_INC_OPT@$(QT_INC) \
-       $(OPTIMIZATION) -DHAVE_CONFIG_H -DNEW_STRINGS @CFLAGS@
+       $(OPTIMIZATION) -DHAVE_CONFIG_H -DNEW_STRINGS
 LDFLAGS=$(EXTRA_LDFLAGS) @LDFLAGS@
 PREFIX=@prefix@
 INSTALL_DIR=$(DESTDIR)/$(PREFIX)
@@ -117,9 +117,9 @@ OBJS = main.o globals.o $(LIBOBJS) @FILEINFO@
 DEPFILES = $(OBJS:.o=.d)
 
 .cc.o:
-       $(CXX)  @CPPFLAGS@ @CXXFLAGS@ -c $(GBCFLAGS) $< $(OUTPUT_SWITCH)$@
+       $(CXX) @CPPFLAGS@ @CXXFLAGS@ -c $(GBCFLAGS) $< $(OUTPUT_SWITCH)$@
 .c.o:
-       $(CC)  @CPPFLAGS@ @CFLAGS@ -c $(GBCFLAGS) $< $(OUTPUT_SWITCH)$@
+       $(CC) @CPPFLAGS@ @CFLAGS@ -c $(GBCFLAGS) $< $(OUTPUT_SWITCH)$@
 
 
 
@@ -139,10 +139,10 @@ gui linux-gui mac-gui mac-gui-dmg msvc-build test-release
 all: gpsbabel$(EXEEXT)
 
 gpsbabel$(EXEEXT): configure Makefile $(OBJS) @GPSBABEL_DEBUG@ 
-       $(CXX)  $(CXXFLAGS) $(LDFLAGS) $(OBJS) @LIBS@ $(QT_LIBS) @USB_LIBS@ $(OUTPUT_SWITCH)$@
+       $(CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJS) @LIBS@ $(QT_LIBS) @USB_LIBS@ $(OUTPUT_SWITCH)$@
 
 gpsbabel-debug: $(OBJS)
-       $(CXX)  $(CFLAGS) $(LDFLAGS) $(OBJS) @LIBS@ @EFENCE_LIB@ $(QT_LIBS) @USB_LIBS@ $(OUTPUT_SWITCH)$@
+       $(CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJS) @LIBS@ @EFENCE_LIB@ $(QT_LIBS) @USB_LIBS@ $(OUTPUT_SWITCH)$@
 
 Makefile gbversion.h: Makefile.in config.status xmldoc/makedoc.in \
          gbversion.h.in gui/setup.iss.in
@@ -155,7 +155,7 @@ config.status: configure
        $(SHELL) config.status --recheck
 
 jeeps/gpslibusb.o: 
-       $(CXX)  @CPPFLAGS@ -c $(GBCFLAGS) @USB_CFLAGS@ @srcdir@/jeeps/gpslibusb.cc $(OUTPUT_SWITCH)$@
+       $(CXX) @CPPFLAGS@ @CXXFLAGS@ -c $(GBCFLAGS) @USB_CFLAGS@ @srcdir@/jeeps/gpslibusb.cc $(OUTPUT_SWITCH)$@
 
 fileinfo.o: win32/gpsbabel.rc
        $(RC) -o fileinfo.o win32/gpsbabel.rc
index 56a04462065b6bd57332997bda13a241cc9c59e3..1ba0a401bcfeef9fe64d96c0f1a4bb43619ea60e 100755 (executable)
@@ -4233,6 +4233,7 @@ fi
 
 if test $GCC = yes; then
  CFLAGS="$CFLAGS -Wall"
+ CXXFLAGS="$CXXFLAGS -Wall"
 fi
 
 if test "$cet" = "all"; then
@@ -4438,7 +4439,7 @@ esac
 # If qmake-qt4 isn't found look for the standard name qmake and assume it is
 # from a useful version Qt.
 if test -n "$ac_tool_prefix"; then
-  for ac_prog in qmake-qt4 qmake
+  for ac_prog in qmake-qt5 qmake-qt4 qmake
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
@@ -4482,7 +4483,7 @@ fi
 fi
 if test -z "$QMAKE"; then
   ac_ct_QMAKE=$QMAKE
-  for ac_prog in qmake-qt4 qmake
+  for ac_prog in qmake-qt5 qmake-qt4 qmake
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -4537,7 +4538,7 @@ esac
   fi
 fi
 
-for ac_prog in lupdate-qt4 lupdate
+for ac_prog in lupdate-qt5 lupdate-qt4 lupdate
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -4579,7 +4580,7 @@ fi
   test -n "$LUPDATE" && break
 done
 
-for ac_prog in lrelease-qt4 lrelease
+for ac_prog in lrelease-qt5 lrelease-qt4 lrelease
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -4623,10 +4624,16 @@ done
 
 
 if test "$QMAKE" = no ; then
-  as_fn_error $? "Qt4 is required, but not found" "$LINENO" 5;
+  as_fn_error $? "Qt4 or Qt5 is required, but neither was found" "$LINENO" 5;
 fi
 
-QT_LIBS="-L$($QMAKE -query QT_INSTALL_LIBS) -l QtCore"
+# guess the name of the Qt Core library.
+QT_LIBVER=$($QMAKE -query -query QT_VERSION | sed -e 's/\..*//')
+if test "$QT_LIBVER" -ge 5 ; then
+       QT_LIBS="-L$($QMAKE -query QT_INSTALL_LIBS) -l Qt${QT_LIBVER}Core"
+else
+       QT_LIBS="-L$($QMAKE -query QT_INSTALL_LIBS) -l QtCore"
+fi
 QT_INC=$($QMAKE -query QT_INSTALL_HEADERS)
 QT_INC_OPT="-I"
 QT_SYSINC_OPT="-isystem"
@@ -4856,6 +4863,52 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        ;;
 esac
 
+case "$target" in
+       *-*-darwin*)
+       ;;
+       *)
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for reduce relocations" >&5
+$as_echo_n "checking for reduce relocations... " >&6; }
+       OCPPFLAGS="$CPPFLAGS"
+       CPPFLAGS="$CPPFLAGS -I$QT_INC"
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+               #include <QtCore/QString>
+               void f(void) {
+               }
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+else
+  OCXXFLAGS="$CXXFLAGS"
+               CXXFLAGS="$CXXFLAGS -fPIE"
+               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+                       #include <QtCore/QString>
+                       void f(void) {
+                       }
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                       CFLAGS="$CFLAGS -fPIE"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5
+$as_echo "unknown" >&6; }
+                       CXXFLAGS="$OCXXFLAGS"
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       CPPFLAGS="$OCPPFLAGS"
+       ;;
+esac
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for random stuff to make you feel better" >&5
 $as_echo_n "checking for random stuff to make you feel better... " >&6; }
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
index 44b4c93b1c2f01ec2c4f2cdd9d90d12791a126be..88e797d20c372b0026836e5e87de8bfa9e5d9129 100644 (file)
@@ -55,6 +55,7 @@ AC_ARG_WITH(cet,[  --with-cet=(default,all,minimal)],
 
 if test $GCC = yes; then
  CFLAGS="$CFLAGS -Wall"
+ CXXFLAGS="$CXXFLAGS -Wall"
 fi
 
 if test "$cet" = "all"; then
@@ -156,15 +157,21 @@ AC_SUBST(RC)
 # On RHEL/OEL/SL/CENTOS/FEDORA qmake is from Qt3, and qmake-qt4 is from Qt4.
 # If qmake-qt4 isn't found look for the standard name qmake and assume it is
 # from a useful version Qt.
-AC_CHECK_TOOLS(QMAKE, [qmake-qt4 qmake], "no")
-AC_CHECK_PROGS(LUPDATE, [lupdate-qt4 lupdate])
-AC_CHECK_PROGS(LRELEASE, [lrelease-qt4 lrelease])
+AC_CHECK_TOOLS(QMAKE, [qmake-qt5 qmake-qt4 qmake], "no")
+AC_CHECK_PROGS(LUPDATE, [lupdate-qt5 lupdate-qt4 lupdate])
+AC_CHECK_PROGS(LRELEASE, [lrelease-qt5 lrelease-qt4 lrelease])
 
 if test "$QMAKE" = no ; then
-  AC_MSG_ERROR([Qt4 is required, but not found]);
+  AC_MSG_ERROR([Qt4 or Qt5 is required, but neither was found]);
 fi
 
-QT_LIBS="-L$($QMAKE -query QT_INSTALL_LIBS) -l QtCore"
+# guess the name of the Qt Core library.
+QT_LIBVER=$($QMAKE -query -query QT_VERSION | sed -e 's/\..*//')
+if test "$QT_LIBVER" -ge 5 ; then
+       QT_LIBS="-L$($QMAKE -query QT_INSTALL_LIBS) -l Qt${QT_LIBVER}Core"
+else
+       QT_LIBS="-L$($QMAKE -query QT_INSTALL_LIBS) -l QtCore"
+fi
 QT_INC=$($QMAKE -query QT_INSTALL_HEADERS)
 QT_INC_OPT="-I"
 QT_SYSINC_OPT="-isystem"
@@ -283,6 +290,34 @@ case "$target" in
        ;;
 esac
 
+case "$target" in
+       *-*-darwin*)
+       ;;
+       *)
+       AC_MSG_CHECKING(for reduce relocations)
+       OCPPFLAGS="$CPPFLAGS"
+       CPPFLAGS="$CPPFLAGS -I$QT_INC"
+       AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+               #include <QtCore/QString>
+               void f(void) {
+               }])],
+               [AC_MSG_RESULT(no)],
+               [OCXXFLAGS="$CXXFLAGS"
+               CXXFLAGS="$CXXFLAGS -fPIE"
+               AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+                       #include <QtCore/QString>
+                       void f(void) {
+                       }])],
+                       [AC_MSG_RESULT(yes)
+                       CFLAGS="$CFLAGS -fPIE"],
+                       [AC_MSG_RESULT(unknown)
+                       CXXFLAGS="$OCXXFLAGS"]
+                       )]
+               )
+       CPPFLAGS="$OCPPFLAGS"
+       ;;
+esac
+
 AC_MSG_CHECKING(for random stuff to make you feel better)
 AC_MSG_RESULT(failed)